# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header

inherit subversion

ESVN_REPO_URI="http://metasploit.com/svn/framework3/trunk/"

MY_P="${P/metasploit/framework}"
S="${WORKDIR}/${MY_P}"

DESCRIPTION="The Metasploit Framework is an advanced open-source platform for
developing, testing, and using vulnerability exploit code. (SVN)"
HOMEPAGE="http://www.metasploit.org/"
SRC_URI=""

LICENSE="GPL-2 Artistic"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE=""

RDEPEND="dev-lang/ruby
	dev-ruby/rex
    gtk? ( dev-ruby/ruby-libglade2 )
    httpd? ( =dev-ruby/rails-1.2* )
    sqlite? ( dev-ruby/sqlite-ruby
        dev-ruby/activerecord )
    sqlite3? ( dev-ruby/sqlite3-ruby
         dev-ruby/activerecord )
    postgres? ( dev-ruby/ruby-postgres
        dev-ruby/activerecord )"
DEPEND=""

src_install() {
	dodir /usr/lib/
	dodir /usr/bin/

# remove the subversion directories
	find ${S} -type d -name ".svn" | xargs rm -R

# should be as simple as copying everything into the target...
	dodir /usr/lib/metasploit${SLOT}
	cp -R "${S}"/* "${D}"/usr/lib/metasploit${SLOT} || die "Copy files failed"
	rm -Rf "${D}"/usr/lib/metasploit${SLOT}/documentation "${D}"/README

	for file in `ls msf*`; do
		dosym /usr/lib/metasploit${SLOT}/${file} /usr/bin/${file}${SLOT}
	done

	chown -R root:root ${D}

	if use httpd; then
		newinitd "${FILESDIR}"/msfweb${SLOT}.initd msfweb${SLOT} \
			|| die "newinitd failed"
		newconfd "${FILESDIR}"/msfweb${SLOT}.confd msfweb${SLOT} \
			|| die "newconfd failed"
	fi
}

